package com.mew.common.entity.mail;

import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import java.io.Serializable;

import com.zebra.common.ByteBufUtils;
import io.netty.buffer.ByteBuf;
import io.netty.channel.unix.Buffer;
import lombok.*;
import lombok.experimental.Accessors;
import org.springframework.core.io.buffer.DataBufferUtils;

/**
 * <p>
 * 附件
 * </p>
 *
 * @author Dylin
 * @since 2021-04-01
 */
@Data
@TableName("m_accessory")
@ToString
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class Accessory implements Serializable {

    private static final long serialVersionUID=1L;

    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    /**
     * 邮件ID
     */
    private Integer mailId;

    /**
     * 附件类型 0 金币 1 钻石
     */
    private Integer type;

    /**
     * 数量
     */
    private Long quantity;

    public void write(ByteBuf b) {
/*        ByteBufUtils.writeInt(b,id);*/
        ByteBufUtils.writeInt(b,type);
        ByteBufUtils.writeLong(b,quantity);
    }
}
